using AliDDNS.Model;
using AliDDNS.Service;
using Microsoft.Extensions.Logging.Configuration;
using Microsoft.Extensions.Logging.EventLog;

var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddWindowsService( );
LoggerProviderOptions.RegisterProviderOptions<EventLogSettings, EventLogLoggerProvider>(builder.Services);

// 启用 reloadOnChange 以支持动态更新
builder.Configuration.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true).AddUserSecrets<Program>( );


builder.Services.AddSingleton<AllDNSRecord>( );

builder.Services.AddHostedService<WindowsBackgroundService>( );

var host = builder.Build( );
host.Run( );
